package com.ycl.web.backend;

import com.ycl.model.EbUser;
import com.ycl.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Controller
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UsersService usersService;

    /**
     * 用户分页查询
     */
    @RequestMapping("/list")
    public String list(Model model,
                             @RequestParam(value = "page",defaultValue = "1")Integer page,
                             @RequestParam(value = "pageSize",defaultValue = "5")Integer pageSize){
        List<EbUser> ebUsers = usersService.userList(page, pageSize);
        model.addAttribute("ebUsers",ebUsers);
        return "manage/user";
    }
}
